﻿@using GuRenFang.Common
@model GuRenFang.Service.Entity.Pager<GuRenFang.Service.Entity.Photos>

<style type="text/css">
    .gallery li img
    {
        height: 150px;
        width: 150px;
    }
</style>
<div class="grid_16 widget tabs first">
    <div class="widget_title clearfix">
        <h2>首页图片</h2>
        <ul>
            <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active">
                <a href="@Url.Content("~/management/HomePage/UploadImages")" ><span>上传首页图片</span></a>
            </li>
        </ul>
    </div>
    <div class="widget_body">
        <div class="widget_content">
            <ul class="gallery">
                @foreach (var item in Model.DataSource)
                {
                    <li><a rel="prettyPhoto[HomePage]" href="@Url.Content("~" + item.ImgPath)" class="gallerythumb" title="@item.Content">
                        <img src="@Url.Content("~" + item.ThumbnailPath)" alt="@item.Title" /></a>
                        <ul class="img_options">
                            <li><a href="@Url.Content("~/management/Homepage/UpdateImages?id=" + @item.Id)" class="btn">修改</a></li>
                            <li><a href="@Url.Content("~/management/Homepage/DeleteImages?id=" + @item.Id + "&file=" + Url.Content("~" + item.ImgPath))" class="btn" data="delete">删除</a></li>
                        </ul>
                    </li>
                }

            </ul>
            <div class="clear">
            </div>
        </div>
        @Html.Partial("_AdminPager", Model.Item)
    </div>
</div>
<div class="clear">
</div>
<script type='text/javascript'>
    $(document).ready(function () {
        $(".gallerythumb").bind("mouseenter", function () {
            $(".gallerythumb .btn").hide();
            $(this).parent().find(".btn").show();
        });
        $(".gallery").bind("mouseleave", function () {
            $(this).parent().find(".btn").hide();
        });

        $("a[rel^='prettyPhoto']").prettyPhoto({
            theme: 'facebook',
            opacity: 0.9,
            show_title: true,
            social_tools: false
        });

        $(".gallery li a.btn[data='delete']").click(function () {
            return confirm("确定真的要删除改图片吗？");
        });
    });
</script>
